package com.ysd.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ysd.entity.Userroles;
import com.ysd.service.UserrolesService;
import com.ysd.util.Result;

@RestController
public class UserrolesController {
	@Autowired
	UserrolesService uS;
	@RequestMapping("getUserroles")
	public Object getUserroles(Userroles u) {
		List<Userroles> list=uS.findUserroles(u);
		if (list!=null) {
			return Result.toClient("0", "查询成功", null, list);
		}
		return Result.toClient("1", "查询失败");
	}
	@RequestMapping("tjUserRoles")
	public Object tjUserRoles(Userroles u) {
		int n=uS.tjUserRoles(u);
		if (n>0) {
			return Result.toClient("0", "添加成功");
		}
		return Result.toClient("1", "添加失败");
	}
	@RequestMapping("scUserRoles")
	public Object scUserRoles(Userroles u) {
		int n=uS.scUserRoles(u);
		if (n>0) {
			return Result.toClient("0", "移除成功");
		}
		return Result.toClient("1", "移除失败");
	}
}
